package com.sgb.auction.viewmodule;

import androidx.lifecycle.ViewModel;
import com.sgb.auction.activity.AuctionHallActivity;
import com.sgb.auction.base.BaseApi;
import com.sgb.auction.entity.PublishListBean;
import com.swgk.core.base.api.ICallBack;
import com.swgk.core.base.model.entity.BaseEntity;
import com.swgk.core.dialog.DialogHelper;

import java.util.List;

/**
 * Time:2021/11/22
 * AUTHOR:F_Q
 * Description:
 */
public class AuctionHallModel extends ViewModel {
    AuctionHallActivity activity;
    private boolean isLastPage;

    public void setActivity(AuctionHallActivity auctionHallActivity) {
        this.activity = auctionHallActivity;
    }

    /**
     * 获取tab页签方法
     */
    public void getAuctionHallTabList() {
        DialogHelper.showProgressDialog(activity, null, "数据加载中", 0, true, null).setCanceledOnTouchOutside(false);
        BaseApi.getApi().getAuctionStateSelect().enqueue(new ICallBack<BaseEntity<List<PublishListBean>>>() {
            @Override
            public void onSuccess(BaseEntity<List<PublishListBean>> data) {
                DialogHelper.dismissProgressDialog();
                if (data.getState().equals(BaseApi.RESPONSE_OK)){
                   activity.setTabList(data.getData());
                }
            }
        });
    }
}
